package com.zhangzhan.blog_api.controller;

import com.zhangzhan.base.common_model.dtos.BlogLoginDto;
import com.zhangzhan.base.common_model.result.ResponseResult;
import com.zhangzhan.blog_service.service.BlogLoginService;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author 张一恒
 * @version 1.0
 * @description: 登陆控制器
 * @date 2024/2/2 22:22
 */
@RestController
public class BlogLoginController {

    @Autowired
    private BlogLoginService blogLoginService;

    @ApiOperation(value = "博客前台登陆")
    @RequestMapping(value = "/login", method = RequestMethod.POST)
    public ResponseResult login(@RequestBody BlogLoginDto dto) {
        return blogLoginService.login(dto);
    }


    @ApiOperation(value = "博客前台退出登陆")
    @RequestMapping(value = "/logout", method = RequestMethod.POST)
    public ResponseResult logout() {
        return blogLoginService.logout();
    }
}
